package src.com.pwrd.jvmup;

/**
 * @Auther syc.
 * @Date 2016/12/15 14:40.
 */
public class MainTest {
    public static void main(String[] args) {
        Thread thread = new CpuUsed();

        Thread thread1 = new CpuEmpty();
        Thread thread2 = new CpuEmpty();
        Thread thread3 = new CpuEmpty();
        thread.start();
        thread1.start();
        thread2.start();
        thread3.start();

    }

    public static class CpuUsed extends Thread{
        @Override
        public void run() {

            while (true) {
                double num = Math.random();
            }
        }
    }
    public static class CpuEmpty extends Thread {
        @Override
        public void run() {
            while (true) {
                try {
                    sleep(1000);
                    System.out.println("cpuEmpty thread used");

                } catch(Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
